package com;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @Author bhudy
 * @Description 启动spring boot方法
 * @Date 2019-10-30 23:09:37
 * <p>
 * <p>
 * spring boot部署
 * <p>
 * 1.在pom.xml 添加
 * <dependency>
 * <groupId>org.springframework.boot</groupId>
 * <artifactId>spring-boot-starter-tomcat</artifactId>
 * &lt;!&ndash;打包的时候可以不用包进去，别的设施会提供。事实上该依赖理论上可以参与编译，测试，运行等周期。
 * 相当于compile，但是打包阶段做了exclude操作&ndash;&gt;
 * <scope>provided</scope>
 * </dependency>
 * <p>
 * 2.删除com.sys.websocket.WebSocketConfig类里面的serverEndpointExporter方法，该方法部署在外部tomcat需要删除
 * @see com.sys.websocket.WebSocketConfig
 */
@MapperScan(value = {"com.sys.dao", "com.ktr.dao", "com.order.dao"})
@SpringBootApplication
@ServletComponentScan // Servlet、Filter、Listener可以直接通过@WebServlet、@WebFilter、@WebListener注解自动注册，无需其他代码。
@EnableTransactionManagement // 开启事物
public class BhudyApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(BhudyApplication.class, args);
    }


    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(BhudyApplication.class);
    }
}
